package com.heima.comment.config;

import com.heima.comment.interceptor.CommentTokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 陈辉
 * @data 2024 16:34
 */
@Configuration
public class CommentmvcConfig implements WebMvcConfigurer {

    @Autowired
    private CommentTokenInterceptor commentTokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(commentTokenInterceptor)
                .addPathPatterns("/**");
    }
}
